*** REPLICATION TOOLKIT ***

* AUTHORS: CIMINELLI DUVAL FURCERI 

* ARTICLE: EMPLOYMENT PROTECTION DEREGULATION AND LABOR SHARES IN ADVANCED ECONOMIES 

* JOURNAL: REVIEW OF ECONOMICS AND STATISTICS

* OUTPUT: TABLE G4 (Online Appendix)

***************************

cd ""

putexcel set "Tables/G4", modify 

global horizon 6 

************ PREPARE DATASET **********

run "Do files/Clean dataset"

* Placebo shock variables
forvalues i = 2 / 4 {
quietly sum s`i', detail
local sc1 = r(p75)
local sc2 = r(p25)
gen p`i' = (l10.EPLregularworkers*s`i')/(`sc1'-`sc2')  
}

* Lags and forwards of placebo explanatory variables
forvalues s = 2/4 {
forvalues l = 1 / 6 {
gen l`l'p`s' = l`l'.p`s'
}
forvalues f = 1 / 5 {
gen f`f'p`s' = f`f'.p`s'
}
}

* Global for forward placebo variables (Teulings and Zubanov)
forvalues s = 2/4 {
global fp1`s'
global fp2`s' f1p`s'
global fp3`s' f1p`s' f2p`s'
global fp4`s' f1p`s' f2p`s' f3p`s'
global fp5`s' f1p`s' f2p`s' f3p`s' f4p`s'
global fp6`s' f1p`s' f2p`s' f3p`s' f4p`s' f5p`s'
}

************ ANALYSIS **********

forvalues s = 2/4 {
mat mat`s' = J(6,$horizon,.)

forvalues i= 1/$horizon {
* Baseline
quietly reghdfe  Y`i' r`s' l1Y l2Y l3Y l4Y l1r`s' l2r`s' l3r`s' l4r`s' t`s' ${f`i'`s'}, absorb(id_cross_section i.year#id_country i.year#id_industry) cluster(ifscode year) nocons
matrix results = r(table)
mat mat`s'[1,`i'] = results[1,1]
mat mat`s'[2,`i'] = results[2,1]
mat mat`s'[3,`i'] = results[4,1]
* Placebo
quietly reghdfe  Y`i' p`s' l1Y l2Y l3Y l4Y l1p`s' l2p`s' l3p`s' l4p`s' t`s' ${fp`i'`s'}, absorb(id_cross_section i.year#id_country i.year#id_industry) cluster(ifscode year) nocons
matrix results = r(table)
mat mat`s'[4,`i'] = results[1,1]
mat mat`s'[5,`i'] = results[2,1]
mat mat`s'[6,`i'] = results[4,1]
}
}

************ SAVE OUTPUT **********

putexcel B4=matrix(mat2)
putexcel B12=matrix(mat3)
putexcel B20=matrix(mat4)
